`

2

A DVANCED B A SH C ON C EPT S

This chapter covers bash concepts that can make your

scripts more intelligent. You’ll learn how to test

conditions, use loops, consolidate code into functions,

send commands to the background, and more. You’ll also

learn some ways of customizing your bash environment

for penetration testing.

Test Operators

Bash lets us selectively execute commands when certain conditions of interest

are met. We can use test operators to craft a wide variety of conditions, such as

whether one value equals another value, whether a file is of a certain type, or

whether one value is greater than another. We often rely on such tests to determine

Black Hat Bash (Early Access) © 2023 by Dolev Farhi and Nick Aleks